package com.tuyrt.`as`.proj.common.ui.component

import android.app.Application
import com.google.gson.Gson
import com.tuyrt.hi.library.klog.KLog
import com.tuyrt.hi.library.log.HiConsolePrinter
import com.tuyrt.hi.library.log.HiFilePrinter
import com.tuyrt.hi.library.log.HiLogConfig
import com.tuyrt.hi.library.log.HiLogManager
import com.tuyrt.hi.library.util.ActivityManager


open class HiBaseApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        initLog()
        initConfig()

    }

    private fun initConfig() {

    }

    private fun initLog() {
        HiLogManager.init(object : HiLogConfig() {
            override fun injectJsonParser(): JsonParser {
                return JsonParser { src: Any? -> Gson().toJson(src) }
            }

            override fun includeThread(): Boolean {
                return true
            }
        }, HiConsolePrinter(), HiFilePrinter.getInstance(cacheDir.absolutePath, 0))

        KLog.init(true, "KLog")
        ActivityManager.instance.init(this)
    }
}